Imports CrystalDecisions.CrystalReports.Engine

Public Class FrmCrHangHoa
    Private trang As Integer
    Private reportPath As String
    Private customerReport As ReportDocument
    Private flagIn As Integer = 0
    Public Sub setTrang(ByVal s As Integer)
        trang = s
    End Sub
    Public Sub setInBaocao(ByVal s As Integer)
        flagIn = s
    End Sub
    Private Sub FrmCrHangHoa_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ConfigureCrystalReports()
    End Sub
    Private Sub ConfigureCrystalReports()
        Dim sqlQuery As String = "SELECT * FROM tbl_hanghoa"
        If flagIn = 0 Then
            reportPath = Application.StartupPath & "\" & "crHangHoa.rpt"
        Else
            reportPath = Application.StartupPath & "\" & "crHangHoa_HosoGDP.rpt"
        End If
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        customerReport.SetParameterValue("company", globalVariale.COMPANY)
        customerReport.SetParameterValue("address", globalVariale.ADDRESS)
        If flagIn = 1 Then
            customerReport.SetParameterValue("trang", trang)
        End If

        Me.CrNganhangview.ReportSource = customerReport
    End Sub
End Class
